from flask import render_template

from . import index_blu
from models import db
from models.user import User


@index_blu.route('/')
def index():
    """
    处理一个页面的逻辑
    :return:
    """
    # return 'hello flask'

    # 通过flask-sqlalchemy查询数据
    user = db.session.query(User).first()

    # 返回响应结果
    # return "我的名字是:%s" % user.username

    return render_template("index.html", name=user.username, user=user)
    # return render_template("index2.html")
